package com.gilight.base.model;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.util.Date;

/**
 * Created by rize on 2019/7/4.
 */
@Data
@TableName("unimall_coupon")
public class CouponDO extends SuperDO {

    private String title;

    private Integer type;

    private String description;

    private Integer total;

    private Integer surplus;

    @TableField("`limit`")
    private Integer limit;

    private Integer discount;

    @TableField("`min`")
    private Integer min;

    /**
     * 0:下架
     * 1: 正常
     */
    private Integer status;

    @TableField("category_id")
    private Long categoryId;

    private Integer days;

    @TableField("gmt_start")
    private Date gmtStart;

    @TableField("gmt_end")
    private Date gmtEnd;

    /**
     * 是否是vip专享
     * 0:不是，1:是
     */
    private Integer isVip;

    private Long zzjgId;

    /**
     * 0 非注册卷也就是普通卷
     * 1 新用户注册卷
     * 2 老用户带新用户消费后发放的注册卷
     */
    @TableField(exist = false)
    private Integer couponFaSong;

    private String couponSendRule;

    public String getCouponSendRule() {
        return couponSendRule;
    }

    public void setCouponSendRule1(String couponSendRule) {
        if(this.couponFaSong == null){
            this.couponFaSong = 0;
        }
        switch (this.couponFaSong) {
            case 0:
                this.couponSendRule = "notreg";
                break;
            case 1:
                this.couponSendRule = "reg";
                break;
            case 2:
                this.couponSendRule = "old";
                break;
            default:
                this.couponSendRule = "notreg";
        }

    }
}
